﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using FaceDetectionDemo.BLL;
using FaceDetectionDemo.Models;

namespace FaceDetectionDemo
{
    public partial class TestForm : Form
    {
        public TestForm()
        {
            InitializeComponent();
        }

        Deal dealObj = Deal.Instance;

        private void btnTest_Click(object sender, EventArgs e)
        {
            try
            {
                dealObj.FaceImgPathFile = @"D:\Test00\赵薇s.jpg";
                var v =  dealObj.FaceDetect();
                //var v2 = v.Result;
                this.pic1.Image = v.OriginalImg;
                this.pic2.Image = v.FinishImg;
                MessageBox.Show("OK!");
            }
            catch(Exception ex)
            {
                MessageBox.Show("Err:"+ex.Message);
            }
        }

        private void TestForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            try
            {
                if (MessageBox.Show("是否要退出本程序？", "退出程序", MessageBoxButtons.OKCancel) == DialogResult.OK)
                {                    
                    System.Diagnostics.Process.GetCurrentProcess().Kill();
                }
                else
                {
                    e.Cancel = true;
                }
            }
            catch(Exception ex)
            {
                MessageBox.Show("Err:" + ex.Message);
            }
        }
    }
}
